<%@ page import="com.nus.beans.Project" %>
<%@ page import="java.util.List" %>
<%@ page import="com.nus.beans.User" %>
<%@ page import="com.nus.beans.UserType" %>
<%@ page import="org.apache.commons.lang3.StringEscapeUtils" %>
<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 9/26/12
  Time: 12:34 AM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <script type="text/javascript">
        function submitForm(action) {
            form = document.getElementById('usersForm');

            form.action = action;
            form.submit();
        }
    </script>
    <title>Project Information</title></head>
<%
    String errorMessage = (String) request.getAttribute("ERROR_MESSAGE");
    User user = (User) session.getAttribute("user");
%>
<body>
<P>Project Information</P>

<form method="post" id="usersForm">

    <select name="projects" size="10">
        <%
            List<Project> projectsList = (List<Project>) request.getAttribute("projectsList");


            for (Project project : projectsList) {

        %>

        <option value="<%=project.getId() %>"><%=StringEscapeUtils.escapeXml(project.getProjectName())%><%="     "%> <%= project.getStatus() %>
        </option>
        <% } %>

    </select>
    <br/>

    <br/>
    <input type="button" value="View Info" onclick="submitForm('viewProjectInfo.do')"/>
    <input type="button" value="Project Remarks" onclick="submitForm('viewProjectRemarks.do')"/>
    <%
        if (user.getUserType().equals(UserType.PM)) {

    %>
    <input type="button" value="Delete" onclick="submitForm('deleteProject.do')"/>
    <input type="button" value="Update" onclick="submitForm('loadUpdateProject.do')"/>
    <% } %>
    <a href="viewHome.do">Home</a>
</form>
<%if (errorMessage != null) {
    %>
    <%=errorMessage %>

    <% } %>
</body>
</html>